package com.ybkj.chat.module.dynamic.fragment;

import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.ybkj.chat.R;
import com.ybkj.chat.base.BaseMvpFragment;
import com.ybkj.chat.bean.DynamicData;
import com.ybkj.chat.module.dynamic.adapter.AddGroupAdapter;
import com.ybkj.chat.ui.view.recyclerview.XRecyclerView;
import com.ybkj.chat.utils.ToastUtil;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 加群
 */
public class AddGroupFragment extends BaseMvpFragment {
    @BindView(R.id.message_search)
    ImageView messageSearch;
    @BindView(R.id.message_cancel)
    ImageView messageCancel;
    @BindView(R.id.search)
    RelativeLayout search;
    @BindView(R.id.groupirc)
    XRecyclerView groupirc;

    private List<DynamicData> datas;
    private AddGroupAdapter mAddGroupAdapter;


    @Override
    protected void injectPresenter() {

    }

    @Override
    protected void initView() {
        //模拟的数据（实际开发中一般是从网络获取的）
        datas = new ArrayList<>();
        DynamicData model;
        for (int i = 0; i < 15; i++) {
            model = new DynamicData();
            model.setTitle("第" + i + "条标题");
            model.setRelationId(i);
            datas.add(model);
        }
        initrecycle();
    }

    @Override
    protected void initData() {

    }

    @Override
    public int getLayoutId() {
        return R.layout.fragment_add_group;
    }

    @Override
    protected String getSimpleNme() {
        return null;
    }

    private void initrecycle() {
        mAddGroupAdapter = new AddGroupAdapter(datas);
        groupirc.setAdapter(mAddGroupAdapter);
        mAddGroupAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                ToastUtil.showShort(position + "");
            }
        });
    }

    @OnClick({R.id.message_search, R.id.message_cancel, R.id.search})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.message_search:
                break;
            case R.id.message_cancel:
                break;
            case R.id.search:
                break;
        }
    }
}
